package com.attendance.controller;

import com.attendance.common.CommonResult;
import com.attendance.pojo.LeaveRecord;
import com.attendance.pojo.Pages;
import com.attendance.service.LeaveService;
import com.attendance.vo.LeaveRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 请假管理
 *
 * */
@RestController
@RequestMapping("/leave")
public class LeaveController {

    @Autowired
    private LeaveService leaveService;

    @GetMapping("/select")
    public CommonResult find(LeaveRecordVo leaveRecordVo, Pages pages){
        return leaveService.find(leaveRecordVo,pages);
    }

    @PostMapping("/add")
    public CommonResult add(@RequestBody LeaveRecord leaveRecord){
        return leaveService.add(leaveRecord);
    }

    @PutMapping("/update")
    public CommonResult update(@RequestBody LeaveRecord leaveRecord){
        return leaveService.update(leaveRecord);
    }

    @DeleteMapping("/delete")
    public CommonResult delete(@RequestBody LeaveRecord leaveRecord){
        return leaveService.delete(leaveRecord);
    }


}
